package com.rfsp.common.mapper;

import java.util.List;
import java.util.Set;

import com.rfsp.common.base.BaseMapper;
import com.rfsp.common.pojo.po.Privilege;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.rfsp.common.pojo.vo.PrivilegeVO;
import org.springframework.stereotype.Repository;

@Repository
public interface PrivilegeMapper extends BaseMapper<Privilege> {
	
	@Select("SELECT * from m_user_right t  WHERE t.id in (select right_id from m_user_roleright t where t.role_id in  (84,1200))")
	List<PrivilegeVO> queryPrivilegeList(@Param("priIds") String priIds);
	
	@Select("SELECT * from m_user_right t  WHERE t.right_code = #{roleCode}")
	List<PrivilegeVO> queryPrivilegeList4mcp(@Param("roleCode") String roleCode);
	
	@Select("SELECT count(1) from m_user_right t  WHERE t.sup_right_code = #{roleCode}")
	Integer queryChildPriListCount(@Param("roleCode") String roleCode);
	
	@Select("SELECT * from m_user_right t  WHERE t.sup_right_code = #{roleCode} order by t.id desc")
	List<PrivilegeVO> queryChildPriList(@Param("roleCode") String roleCode);
	
	public Set<String> getRightByRoleCode(String roleCode);
	
	@Select("select distinct r.need_login from m_user_right r where r.url = #{uri}")
	public String getNeedLogin(@Param("uri") String uri);
	
}